Skip to content

Conversation

@nielslyngsoe
Copy link
Member

Fixes #18817

With the aspect that this guides the deveoper to do it right via the UI.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds input validation constraints to the TextBox property editor's "Maximum allowed characters" configuration field. The change prevents developers from entering invalid values (outside the 1-512 range) through the UI, addressing issue #18817.

Key Changes

  • Added config array to the maxChars setting with min (1), max (512), and placeholder (512) constraints
  • Removed the description text that previously indicated "If empty, 512 character limit"

properties: [
{
alias: 'maxChars',
label: 'Maximum allowed characters',
Copy link

Copilot AI Nov 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] The description has been removed, but it would be helpful to update it rather than remove it completely. Consider adding a description similar to TextArea's approach. For example: "If empty, defaults to 512 characters" or "Maximum 512 characters allowed" to clarify the constraint being applied.

Suggested change
label: 'Maximum allowed characters',
label: 'Maximum allowed characters',
description: 'If empty, defaults to 512 characters.',

Copilot uses AI. Check for mistakes.
description: 'If empty, 512 character limit',
propertyEditorUiAlias: 'Umb.PropertyEditorUi.Integer',
config: [
{ alias: 'min', value: 1 },
Copy link

Copilot AI Nov 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] The minimum value is set to 1, which prevents users from setting maxChars to 0. However, the related TextArea property editor allows a minimum of 0 for its maxChars configuration (meaning unlimited). Consider whether TextBox should also allow 0 for consistency, or if there's a specific reason to enforce a minimum of 1 character.

Suggested change
{ alias: 'min', value: 1 },
{ alias: 'min', value: 0 },

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Error "Microsoft.Data.SqlClient.SqlException (0x80131904): String or binary data would be truncated in table" during save

2 participants